﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 提交管理平台V1
{
    public partial class frmExportTemplate : Form
    {
        UserInfo ui;

        string result = string.Empty;

        public frmExportTemplate(UserInfo tmpui)
        {
            InitializeComponent();
            ui = tmpui;
        }

        private void frmExportTemplate_Load(object sender, EventArgs e)
        {
            iniComboBox();
        }

        private void iniComboBox()
        {
            cmbExportTemplates .Items.Clear();
            for (int i = 1; i <= 10; i++)
            {
                cmbExportTemplates.Items.Add("导出模板" + i.ToString());
            }
            cmbExportTemplates.SelectedIndex = 0;
        }

        private void cmbExportTemplates_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtTemplateContent.Text = ui.GetUserSetting(cmbExportTemplates.Text);
        }

        public static string Show(UserInfo tmpui)
        {
            frmExportTemplate newFrmExportTemplate = new frmExportTemplate(tmpui);
            newFrmExportTemplate.StartPosition = FormStartPosition.CenterParent;
            newFrmExportTemplate.ShowDialog();
            return newFrmExportTemplate.result ;
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            result = txtTemplateContent.Text;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}